package com.aishua.fire.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.aishua.fire.common.anno.PermMapping;
import com.aishua.fire.config.init.ManualUpdatePermTable;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@Api(value = "项目工具操作相关",tags = {"项目工具操作相关接口"})
@RestController
@Slf4j
public class ToolController {

	@Autowired
	private ManualUpdatePermTable manualUpdatePermTable;
	
	
	/**
	 * 通过产品类别id获取产品详情
	 * @param categoryId
	 * @return
	 */
	@PermMapping(noValidate = true)
	@ApiOperation(value="更新perm表接口")
	@GetMapping(value = {"/updatePermTable"} )
	public void updatePermTable() {
		log.info("=========更新perm表数据=====开始");
		manualUpdatePermTable.updatePermTable();
		log.info("=========更新perm表数据=====结束");
    }
	
	@PermMapping(noValidate = true)
	@ApiOperation(value="初始化权限相关表接口")
	@GetMapping(value = {"/initPermTable"} )
	public void initPermTable() {
		log.info("=========初始化perm表数据=====开始");
		manualUpdatePermTable.initPermTable();
		log.info("=========初始化perm表数据=====结束");
	}
	
}
